#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int minPathSum(int** grid, int gridSize, int* gridColSize);

int main()
{
	return 0;
}

int minPathSum(int** grid, int gridSize, int* gridColSize)
{
	int rowLen = gridSize, colLen = *gridColSize;
	for (int col = 1; col < colLen; col++)
		grid[0][col] += grid[0][col - 1];
	for (int row = 1; row < rowLen; row++) {
		grid[row][0] += grid[row - 1][0];
		for (int col = 1; col < colLen; col++)
			grid[row][col] += fmin(grid[row][col - 1], grid[row - 1][col]);
	}

	return grid[rowLen - 1][colLen - 1];
}
